using System;
using System.Collections.Generic;
using Android.Runtime;

namespace Com.Iflytek.Speech {

	[Register ("com/iflytek/speech/DownloadListener", "", "Com.Iflytek.Speech.IDownloadListenerInvoker")]
	public partial interface IDownloadListener : IJavaObject {

		[Register ("onData", "(Ljava/util/ArrayList;)V", "GetOnData_Ljava_util_ArrayList_Handler:Com.Iflytek.Speech.IDownloadListenerInvoker, IFlyBinding")]
		void OnData (global::System.Collections.Generic.IList<global::Com.Iflytek.Speech.SpeakerVerifier.PassWord> p0);

		[Register ("onDownloadError", "(I)V", "GetOnDownloadError_IHandler:Com.Iflytek.Speech.IDownloadListenerInvoker, IFlyBinding")]
		void OnDownloadError (int p0);

	}

	[global::Android.Runtime.Register ("com/iflytek/speech/DownloadListener", DoNotGenerateAcw=true)]
	internal class IDownloadListenerInvoker : global::Java.Lang.Object, IDownloadListener {

		static IntPtr java_class_ref = JNIEnv.FindClass ("com/iflytek/speech/DownloadListener");
		IntPtr class_ref;

		public static IDownloadListener GetObject (IntPtr handle, JniHandleOwnership transfer)
		{
			return global::Java.Lang.Object.GetObject<IDownloadListener> (handle, transfer);
		}

		static IntPtr Validate (IntPtr handle)
		{
			if (!JNIEnv.IsInstanceOf (handle, java_class_ref))
				throw new InvalidCastException (string.Format ("Unable to convert instance of type '{0}' to type '{1}'.",
							JNIEnv.GetClassNameFromInstance (handle), "com.iflytek.speech.DownloadListener"));
			return handle;
		}

		protected override void Dispose (bool disposing)
		{
			if (this.class_ref != IntPtr.Zero)
				JNIEnv.DeleteGlobalRef (this.class_ref);
			this.class_ref = IntPtr.Zero;
			base.Dispose (disposing);
		}

		public IDownloadListenerInvoker (IntPtr handle, JniHandleOwnership transfer) : base (Validate (handle), transfer)
		{
			IntPtr local_ref = JNIEnv.GetObjectClass (Handle);
			this.class_ref = JNIEnv.NewGlobalRef (local_ref);
			JNIEnv.DeleteLocalRef (local_ref);
		}

		protected override IntPtr ThresholdClass {
			get { return class_ref; }
		}

		protected override System.Type ThresholdType {
			get { return typeof (IDownloadListenerInvoker); }
		}

		static Delegate cb_onData_Ljava_util_ArrayList_;
#pragma warning disable 0169
		static Delegate GetOnData_Ljava_util_ArrayList_Handler ()
		{
			if (cb_onData_Ljava_util_ArrayList_ == null)
				cb_onData_Ljava_util_ArrayList_ = JNINativeWrapper.CreateDelegate ((Action<IntPtr, IntPtr, IntPtr>) n_OnData_Ljava_util_ArrayList_);
			return cb_onData_Ljava_util_ArrayList_;
		}

		static void n_OnData_Ljava_util_ArrayList_ (IntPtr jnienv, IntPtr native__this, IntPtr native_p0)
		{
			global::Com.Iflytek.Speech.IDownloadListener __this = global::Java.Lang.Object.GetObject<global::Com.Iflytek.Speech.IDownloadListener> (native__this, JniHandleOwnership.DoNotTransfer);
			System.Collections.Generic.IList<Com.Iflytek.Speech.SpeakerVerifier.PassWord> p0 = global::Android.Runtime.JavaList<global::Com.Iflytek.Speech.SpeakerVerifier.PassWord>.FromJniHandle (native_p0, JniHandleOwnership.DoNotTransfer);
			__this.OnData (p0);
		}
#pragma warning restore 0169

		IntPtr id_onData_Ljava_util_ArrayList_;
		public void OnData (global::System.Collections.Generic.IList<global::Com.Iflytek.Speech.SpeakerVerifier.PassWord> p0)
		{
			if (id_onData_Ljava_util_ArrayList_ == IntPtr.Zero)
				id_onData_Ljava_util_ArrayList_ = JNIEnv.GetMethodID (class_ref, "onData", "(Ljava/util/ArrayList;)V");
			IntPtr native_p0 = global::Android.Runtime.JavaList<global::Com.Iflytek.Speech.SpeakerVerifier.PassWord>.ToLocalJniHandle (p0);
			JNIEnv.CallVoidMethod (Handle, id_onData_Ljava_util_ArrayList_, new JValue (native_p0));
			JNIEnv.DeleteLocalRef (native_p0);
		}

		static Delegate cb_onDownloadError_I;
#pragma warning disable 0169
		static Delegate GetOnDownloadError_IHandler ()
		{
			if (cb_onDownloadError_I == null)
				cb_onDownloadError_I = JNINativeWrapper.CreateDelegate ((Action<IntPtr, IntPtr, int>) n_OnDownloadError_I);
			return cb_onDownloadError_I;
		}

		static void n_OnDownloadError_I (IntPtr jnienv, IntPtr native__this, int p0)
		{
			global::Com.Iflytek.Speech.IDownloadListener __this = global::Java.Lang.Object.GetObject<global::Com.Iflytek.Speech.IDownloadListener> (native__this, JniHandleOwnership.DoNotTransfer);
			__this.OnDownloadError (p0);
		}
#pragma warning restore 0169

		IntPtr id_onDownloadError_I;
		public void OnDownloadError (int p0)
		{
			if (id_onDownloadError_I == IntPtr.Zero)
				id_onDownloadError_I = JNIEnv.GetMethodID (class_ref, "onDownloadError", "(I)V");
			JNIEnv.CallVoidMethod (Handle, id_onDownloadError_I, new JValue (p0));
		}

	}

	public partial class DataEventArgs : global::System.EventArgs {

		public DataEventArgs (global::System.Collections.Generic.IList<global::Com.Iflytek.Speech.SpeakerVerifier.PassWord> p0)
		{
			this.p0 = p0;
		}

		global::System.Collections.Generic.IList<global::Com.Iflytek.Speech.SpeakerVerifier.PassWord> p0;
		public global::System.Collections.Generic.IList<global::Com.Iflytek.Speech.SpeakerVerifier.PassWord> P0 {
			get { return p0; }
		}
	}

	public partial class DownloadErrorEventArgs : global::System.EventArgs {

		public DownloadErrorEventArgs (int p0)
		{
			this.p0 = p0;
		}

		int p0;
		public int P0 {
			get { return p0; }
		}
	}

	[global::Android.Runtime.Register ("mono/com/iflytek/speech/DownloadListenerImplementor")]
	internal sealed class IDownloadListenerImplementor : global::Java.Lang.Object, IDownloadListener {

		object sender;

		public IDownloadListenerImplementor (object sender)
			: base (global::Android.Runtime.JNIEnv.CreateInstance ("mono/com/iflytek/speech/DownloadListenerImplementor", "()V"), JniHandleOwnership.TransferLocalRef)
		{
			this.sender = sender;
		}

#pragma warning disable 0649
		public EventHandler<DataEventArgs> OnDataHandler;
#pragma warning restore 0649

		public void OnData (global::System.Collections.Generic.IList<global::Com.Iflytek.Speech.SpeakerVerifier.PassWord> p0)
		{
			if (OnDataHandler != null)
				OnDataHandler (sender, new DataEventArgs (p0));
		}
#pragma warning disable 0649
		public EventHandler<DownloadErrorEventArgs> OnDownloadErrorHandler;
#pragma warning restore 0649

		public void OnDownloadError (int p0)
		{
			if (OnDownloadErrorHandler != null)
				OnDownloadErrorHandler (sender, new DownloadErrorEventArgs (p0));
		}

		internal static bool __IsEmpty (IDownloadListenerImplementor value)
		{
			return value.OnDataHandler == null && value.OnDownloadErrorHandler == null;
		}
	}

}
